package Json;

import org.json.JSONException;
import org.json.JSONObject;

/**
 * @author macpro
 * @date 2019-07-26
 * @function
 */
public class GsonHasField {
    public static void main(String[] args) throws JSONException {
        String str = "{\"age\":\"1222\"}";

        JSONObject jsonObject = new JSONObject(str);
        System.out.println(jsonObject.getString("age"));
        System.out.println("no has field "+jsonObject.getString("name"));
    }
}
